using UnityEngine;
using System.Collections;

public class Tiro2 : MonoBehaviour {
	
	public Transform ExplosaoPequena;
	float speed = 2.0f;
	bool disparei2 = false;
	Vector3 vaipraparede = new Vector3(0,0,1);
	float tempoTiro = 0;
	
	// Use this for initialization
	void Start ()
	{
	
	}
	
	// Update is called once per frame
	void Update ()
	{
		
		if(Input.GetKeyDown(KeyCode.S))
		{
			disparei2 = true;
			tempoTiro++;				
		}
		
		
		if(disparei2)
		{
			transform.Translate(vaipraparede*speed);
		}
		
		
	}
	
	void OnCollisionEnter(Collision collision)
	{
		Quaternion rotacao = new Quaternion(transform.position.x, transform.position.y, transform.position.z, 0 );
		Instantiate(ExplosaoPequena, transform.position, rotacao);
		Destroy(collision.gameObject);
		Destroy(this);
	    
	}
}
